import request from '@/utils/request'

export default {

  // 添加课程
  addCourse(course) {
    return request({
      url: '/eduCourse/addCourse',
      method: 'post',
      data: course
    });
  },
  // 删除课程信息
  deleteCourse(id) {
    return request({
      url: `/eduCourse/${id}`,
      method: 'delete'
    });
  },
  // 修改课程
  updateCourse(course) {
    return request({
      url: '/eduCourse/updateCourse',
      method: 'put',
      data: course
    });
  },
  // 查询指定课程id的章节和小节信息
  getAllChapterAndVideo(courseId) {
    return request({
      url: `/eduChapter/selectChapters/${courseId}`,
      method: 'get'
    });
  },
  // 新增章节信息
  addChapter(chapter) {
    return request({
      url: '/eduChapter/addChapter',
      method: 'post',
      data: chapter
    });
  },
  // 修改章节信息
  updateChapter(chapter) {
    return request({
      url: '/eduChapter/updateChapter',
      method: 'put',
      data: chapter
    });
  },
  // 删除章节信息
  deleteChapter(id) {
    return request({
      url: `/eduChapter/deleteChapterById/${id}`,
      method: 'delete'
    });
  },
  // 新增小节信息
  addVideo(video) {
    return request({
      url: '/eduChapter/addVideo',
      method: 'post',
      data: video
    });
  },
  // 修改小节信息
  updateVideo(video) {
    return request({
      url: '/eduChapter/updateVideo',
      method: 'put',
      data: video
    });
  },
  // 删除小节信息
  deleteVideo(id) {
    return request({
      url: `/eduChapter/deleteVideo/${id}`,
      method: 'delete'
    });
  },
  // 获取课程信息
  selectCourseInfo(courseId) {
    return request({
      url: `/eduCourse/selectCourseInfo/${courseId}`,
      method: 'get'
    });
  },
  // 发布课程信息
  updateStatus(courseId) {
    return request({
      url: `/eduCourse/updateStatus/${courseId}`,
      method: 'put'
    });
  },
  // 查询课程信息列表
  selectCourses(course) {
    return request({
      url: '/eduCourse/selectCourses',
      method: 'post',
      data: course
    });
  },
  // 查询其他视频信息
  selectVideoInfo(videoId) {
    return request({
      url: `/video/getVideo/${videoId}`,
      method: 'get'
    });
  },
  // 删除视频
  deleteVideoByVideoId(videoId) {
    return request({
      url: `/video/deleteVideo/${videoId}`,
      method: 'delete'
    });
  },
  // 根据课程id查询课程信息
  selectCourseById(courseId) {
    return request({
      url: `/eduCourse/selectCourseById/${courseId}`,
      method: 'get'
    });
  },
  // 下架课程
  updateCourseStatus(ids) {
    return request({
      url: `/eduCourse/updateCourseStatus`,
      method: 'put',
      data: ids
    });
  }
}
